<?php

class Session
{
    private $ap_name_ = 'POLICIESGIS';
    private static $class_instance_;
    private static $instance_ = false;

    protected function __construct()
    {
        if(ini_get("session.auto_start") == 0)
        {
            session_name("sid");
            session_start();
        }
        ini_set('arg_separator.output','&amp;');
    }
        
    public function __destruct(){}
    
    private function __clone(){}
    
    public static function getInstance()
    {
        if(!self::$instance_)
        {
            self::$class_instance_ = new Session();
            self::$instance_ = true;
            return self::$class_instance_;
        }
        return self::$class_instance_;
    }
    
    /**
    * @param: (string) name
    *
    * @param: (mixed) value
    */
    public function set($name, $value)
    {
        if(isset($_SESSION[$this->ap_name_][$name]) && $value === null)
            unset($_SESSION[$this->ap_name_][$name]);
        else
            $_SESSION[$this->ap_name_][$name] = $value;
    }
    
    /**
    * @return: (mixed)
    *
    * @param: (string) name
    */
    public function get($name)
    {
        if(isset($_SESSION[$this->ap_name_][$name]))
            return $_SESSION[$this->ap_name_][$name];
        return false;
    }
}

?>
